package com.s4j.core.manager.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="S4J_SYSBUTTON")
public class SysButton {

	private Long buttonId;
	
	private String buttonNo;
	
	private String buttonName;
	
	/*
	 * 调用的JS方法
	 */
	private String func;
	
	private Integer sortNum;
	
	private String icon;
	
	/*
	 * 1：有效；  0：无效
	 */
	private Short valid;
	
	/*
	 * 是否权限控制；0：没有权限控制；  1：有权限控制;
	 * 例如页面刷新等操作，则不需要权限控制
	 */
	private Short isAuth;
	
	private SysMenu menu;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getButtonId() {
		return buttonId;
	}

	public void setButtonId(Long buttonId) {
		this.buttonId = buttonId;
	}

	@Column(length=50, nullable=false)
	public String getButtonNo() {
		return buttonNo;
	}

	public void setButtonNo(String buttonNo) {
		this.buttonNo = buttonNo;
	}

	@Column(length=50, nullable=false)
	public String getButtonName() {
		return buttonName;
	}

	public void setButtonName(String buttonName) {
		this.buttonName = buttonName;
	}

	@Column(length=50, nullable=false)
	public String getFunc() {
		return func;
	}

	public void setFunc(String func) {
		this.func = func;
	}

	@Column(precision=5, scale=0, nullable=false)
	public Integer getSortNum() {
		return sortNum;
	}

	public void setSortNum(Integer sortNum) {
		this.sortNum = sortNum;
	}

	@Column(length=100, nullable=true)
	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	@Column(precision=2, scale=0, nullable=false)
	public Short getValid() {
		return valid;
	}

	public void setValid(Short valid) {
		this.valid = valid;
	}

	@Column(precision=2, scale=0, nullable=false)
	public Short getIsAuth() {
		return isAuth;
	}

	public void setIsAuth(Short isAuth) {
		this.isAuth = isAuth;
	}

	@ManyToOne(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
	@JoinColumn(name="menuId")
	public SysMenu getMenu() {
		return menu;
	}

	public void setMenu(SysMenu menu) {
		this.menu = menu;
	}
}
